package cn.cjxy.controller;

import cn.cjxy.domain.Account;
import cn.cjxy.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService accountService;

    @GetMapping
    public List<Account> getAccount() {
        return accountService.findAll();
    }

    @GetMapping("/transfer")
    public String transfer() {
        accountService.transfer(1,2,1000.0);
        return "success";
    }
}
